//
//@File    :	9.9_static.cpp
//@Time    :	2021/08/22 17:19:10
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	using a static local varible
//

#include <iostream>

using namespace std;
const int ArSize = 10;
void strcount(const char *str);
int main()
{
    char input[ArSize];
    char next;

    cout << "Enter a line:\n";
    cin.get(input, ArSize);
    while (cin)
    {
        cin.get(next);
        while (next != '\n')
        {
            cin.get(next);
        }
        strcount(input);
        cout << "Enter next line (enpty line to quit):\n";
        cin.get(input, ArSize);
    }
    cout << "Bye\n";
    system("pause");
    return 0;
}
void strcount(const char *str)
{
    static int total = 0;
    int count = 0;

    cout << "\"" << str << "\"contains ";
    while (*str++)
    {
        count++;
    }
    total += count;
    cout << count << " characters\n";
    cout << total << " characters total\n";
}
